const _form = this.getApiPage().retrievePlugin('base-forms')
const panel = this.pageObj.getApiWidgetByAliasName('event-panel')?.widgetObj
const queryManage = this.pageObj.getApiWidgetByAliasName('queryManage')?.widgetObj
const value = _form.getFormData('form_12')
this.getApiPage().setVariables([{ name: 'event_search', value: value.search }])
const prefix = this.pageObj.getVariables().find(v => v.name === "environmentType")?.value;
const data = {
    pageNum: 1,
    pageSize: 10,
    eventTitle: value.search
}

const panelType = this.getApiPage().getVariables().find(v => v.name === 'panelType')?.value
console.log('panelType', panelType)
const process = this.getApiPage().getVariables().find(v => v.name === 'whetherProcess')?.value
console.log('whetherProcess', process)

// if (publicParams === '1') {
//     data.occurrencePlace = event_params
// } else if (publicParams === '2') {
//     data.eventType = event_params
// } else if (publicParams === '3') {
//     data.eventGrade = event_params
// } else {
//     data.occurrencePlace = event_params ?? undefined
// }

if (+panelType === 0 || !panelType) {
    queryManage.queryDrillNews(process, value.search).then(res => {
        const expand = panel.getExpandSelected()
        expand.clear()
        panel.setData([{data: res}])
        panel.render()
    })
} else {
    queryManage.queryDrillGroup(panelType, process, value.search).then(res => {
        const expand = panel.getExpandSelected()
        expand.clear()
        panel.setData([{data: res}])
        panel.render()
    })
}







// if (event_params) {
//     const options = {
//         method: 'POST',
//         headers: {
//             "Content-type": "application/json",
//         },
//         body: JSON.stringify(data)
//     }

//     fetch(`/${prefix}Event/event/getEventByInfo`, options)
//         .then(res => res.json())
//         .then(json => {
//             if (json?.resultCode === '000000') {
//                 json.result.result.forEach(v => {
//                     if (publicParams?.value === '1') {
//                         v.groupKey = v.occurrencePlace
//                     } else if (publicParams?.value === '2') {
//                         v.groupKey = v.eventType
//                     } else if (publicParams?.value === '3') {
//                         v.groupKey = v.eventGrade
//                     } else {
//                         v.groupKey = v.occurrencePlace
//                     }
//                 })
//                 // panel.widgetObj.setData([json.result]);
//                 // panel.widgetObj.render()
//             }

//         })
// }
